<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><spring:message code="message.listForm.qiYeChanPinKuGuanLi"/><spring:message code="message.lable.proddruginfoStd"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
    

</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <!-- 操作列超过三条使用 更多弹窗 -->
    <div class="box box-primary" id="more" style="width:70px;height:35px;background-color:#2C3B41;position:absolute;z-index:9999;left:850px;top:100px;display:none;font-size:12px;border-top-color:#2C3B41;">
            <div class="box-body home-message" id="moreOp">
            </div>
    </div>

    <section class="content-header">
        <h1><spring:message code="message.lable.proddruginfoStd"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.StdManage"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.proddruginfoStd"/></a></li>
        </ol>
    </section>
    
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="input">
                	<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="qualityspecName" name="qualityspecName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" />
                    </div>
                	<div class="textalign1"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugcode" name="drugcode" placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
                    </div>
                    <div class="textalign1"><spring:message code="message.lable.status"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                    	   <select id="status" class="textinput">
                            <option value=""><spring:message code="message.select.option"/></option>
                            <option value="1"><spring:message code="message.button.start"/></option>
                            <option value="0"><spring:message code="message.button.stop"/></option>
                            <option value="3"><spring:message code="message.button.combine"/></option>
                           </select>
                    </div>
                    <div class="textalign1" >
                    <button  id="selectSerch" type="button" onclick="gridSerch();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                </div>
                </div>
            </div>
        </div>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class=" box box-warning bottongroup">
            <ms:btn url='/stdProdDrugInfo/toCompSelfDrugAdd.html'><a href="${ctx}/stdProdDrugInfo/toCompSelfDrugEdit.html?opType=0" class="btn btn-default btn-sm"><spring:message code="message.button.addSpacing"/></a></ms:btn>
        </div>

    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %> 
    <script type="text/javascript">
        
        $(function () {
        	
        	//加载页面光标在名字框内，位于第一个
        	   $("#qualityspecName").focus();
        	   
        	 //绑定回车     id="selectSerch"   
        	   $('#qualityspecName,#drugcode,#status').bind('keydown', function(event) {
        	       if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
        	           $('#selectSerch').click();
        	       }
        	   }); 
            
            $("#gridlist").jqGrid({
                url: "${ctx}/stdProdDrugInfo/getCompSelfDrugList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                shrinkToFit:false,
                height: 270,
                colNames: [ 
                            '<spring:message code="message.jqGrid.cz"/>', 
                            'prodId',
                            'qualityspecId',
                            '<spring:message code="message.listForm.yaoPinBianMa"/>', 
                            '<spring:message code="message.listForm.tongYongMing"/>', 
                            '<spring:message code="message.listForm.jiXing"/>', 
                            '<spring:message code="message.listForm.guiGe"/>',
                            '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
                            '<spring:message code="message.listForm.baoZhuangDanWei"/>',
                            '<spring:message code="message.listForm.caiZhi"/>', 
                            '<spring:message code="message.lable.status"/>',
                            '<spring:message code="message.listForm.shenHeZhuanTai"/>',
                            '<spring:message code="message.jieSuan.auditTime"/>',
                            '<spring:message code="message.jieSuan.auditPeople"/>',
                            '<spring:message code="message.listForm.shenHeBeiZhu"/>' 
                            ],
                colModel: [
					{ name: 'operate', width: 80, align: "center",sortable: false, 
					    formatter : function(val, opts, rowdata) {
					        var str = "";
					        if (rowdata.auditStatus != 1) {
					            str += "<ms:btn url='/stdProdDrugInfo/toCompSelfDrugEdit.html'><a href='${ctx}/stdProdDrugInfo/toCompSelfDrugEdit.html?opType=1&prodId="+rowdata.prodId+"' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat 0px 0px' class='opIcon' title='<spring:message code="message.button.edit"/>'></a></ms:btn>";
					        }
					        str +="<ms:btn url='/stdProdDrugInfo/toCompSelfDrugDetail.html'><a href='${ctx}/stdProdDrugInfo/toCompSelfDrugDetail.html?prodId="+rowdata.prodId+"' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='<spring:message code="message.jqGrid.cz.xiangQing"/>'></a></ms:btn>";
					        return str;
					    }
					},
                    { name: 'prodId', width: 120 ,hidden:true, align:"center",sortable: false},
                    { name: 'qualityspecId',hidden:true, width: 120 , align:"center",sortable: false},
                    { name: 'drugCode', width: 120 , align:"center",sortable: false},
                    { name: 'qualityspecName', width: 180 , align:"left" ,sortable: false},
                    { name: 'formName', width: 80 , align:"center" ,sortable: false},
                    { name: 'specName', width: 80 , align:"left" ,sortable: false},
                    { name: 'factor', width: 80 , align:"center" ,sortable: false},
                    { name: 'unitName', width: 80 , align:"center" ,sortable: false},
                    { name: 'materialName', width: 80 , align:"center" ,sortable: false},
                    { name: 'status', width: 80 , align:"center",sortable: false,
                    	formatter : function(val, opts, rowdata) {
                            if (val == 1) {
                                return "<spring:message code="message.button.start"/>";
                            } else if (val == 3) {
                                return "<spring:message code="message.button.combine"/>";
                            }
                            return "<spring:message code="message.button.stop"/>";
                        }
                    },
                    { name: 'auditStatus', width: 80 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                            if (cellvalue == 0) {
                            	return "<spring:message code="message.select.weishenhe"/>";
                            } else if (cellvalue == 1) {
                            	return "<spring:message code="message.jqGrid.cz.audit"/><spring:message code="message.jieSuan.tongGuo"/>";
                            } else if (cellvalue == 2) {
                            	return "<spring:message code="message.jqGrid.cz.audit"/><spring:message code="message.listForm.buTongGuo"/>";
                            } else if (cellvalue == 3) {
                            	return "<spring:message code="message.select.weitijiao"/>";
                            }
                            return "";
                        }
                    },
                    { name: 'auditDatetime', width: 160 , align:"center",sortable: false },
                    { name: 'auditUser', width: 160 , align:"left",sortable: false },
                    { name: 'auditRemark', width: 180 , align:"left",sortable: false }
                    
                ],
                rowNum: 20,
                rowList: [10,20,50,100],
                rownumbers: true,
                pager: "#gridpage",
                multiselect: false, 
                viewrecords: true,
                caption: "<spring:message code="message.listForm.yaoPin"/><spring:message code="message.listForm.lieBiao"/>",
              //序号宽度自动变化
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                jsonReader: {
                    repeatitems: false,
                    id: "prodId"
                },
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");  
            
        });
        

        //查询
        function gridSerch() {
            var drugcode = $("#drugcode").val();
            var qualityspecName = $("#qualityspecName").val();
            var prodCompName = $("#prodCompName").val();
            var status = $("#status").val();
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"drugCode":drugcode,
                        "qualityspecName":qualityspecName,
                        "prodCompName":prodCompName,
                        "status":status
                        }
            }).trigger("reloadGrid"); //重新载入  
        }
        
        //生产企业弹窗
        function showCompInfo(prodCompId) {
            $.HN.dialog.open({
                "id": "showCompInfo", 
                "title": "<spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.listForm.xinXi"/>", 
                "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+prodCompId,
                "data": {}, 
                "width": 800, 
                "height": 400
            });
        }
        
    </script>
</body>
</html>